<?php

namespace App\Livewire\Components;

use App\Models\Message;
use Livewire\Component;
use Livewire\WithPagination;

class MessageList extends Component
{
    use WithPagination;

    public function render()
    {
        $messages = Message::query()
            ->where('status', 1)
            ->orderByDesc('id')
            ->paginate(10);
        return view('livewire.components.message-list', [
            'messages' => $messages
        ]);
    }
}
